/**
 * @Author: lll
 * @Email:li.lele@vpclub.cn
 * @Date: create in 2020/7/17
 */
/**
 * Minified by jsDelivr using Terser v3.14.1.
 * Original file: /npm/@vant/touch-emulator@1.2.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var eventTarget, supportTouch = "ontouchstart" in window;
document.createTouch || (document.createTouch = function (e, t, n, o, u, c, i) {
    return new Touch(t, n, {
        pageX: o,
        pageY: u,
        screenX: c,
        screenY: i,
        clientX: o - window.pageXOffset,
        clientY: u - window.pageYOffset
    }, 0, 0)
}), document.createTouchList || (document.createTouchList = function () {
    for (var e = TouchList(), t = 0; t < arguments.length; t++) e[t] = arguments[t];
    return e.length = arguments.length, e
});
var Touch = function (e, t, n, o, u) {
    o = o || 0, u = u || 0, this.identifier = t, this.target = e, this.clientX = n.clientX + o, this.clientY = n.clientY + u, this.screenX = n.screenX + o, this.screenY = n.screenY + u, this.pageX = n.pageX + o, this.pageY = n.pageY + u
};

function TouchList() {
    var e = [];
    return e.item = function (e) {
        return this[e] || null
    }, e.identifiedTouch = function (e) {
        return this[e + 1] || null
    }, e
}

var initiated = !1;

function onMouse(e) {
    return function (t) {
        "mousedown" === t.type && (initiated = !0), "mouseup" === t.type && (initiated = !1), ("mousemove" !== t.type || initiated) && (("mousedown" === t.type || !eventTarget || eventTarget && !eventTarget.dispatchEvent) && (eventTarget = t.target), triggerTouch(e, t), "mouseup" === t.type && (eventTarget = null))
    }
}

function triggerTouch(e, t) {
    var n = document.createEvent("Event");
    n.initEvent(e, !0, !0), n.altKey = t.altKey, n.ctrlKey = t.ctrlKey, n.metaKey = t.metaKey, n.shiftKey = t.shiftKey, n.touches = getActiveTouches(t), n.targetTouches = getActiveTouches(t), n.changedTouches = createTouchList(t), eventTarget.dispatchEvent(n)
}

function createTouchList(e) {
    var t = TouchList();
    return t.push(new Touch(eventTarget, 1, e, 0, 0)), t
}

function getActiveTouches(e) {
    return "mouseup" === e.type ? TouchList() : createTouchList(e)
}

function TouchEmulator() {
    window.addEventListener("mousedown", onMouse("touchstart"), !0), window.addEventListener("mousemove", onMouse("touchmove"), !0), window.addEventListener("mouseup", onMouse("touchend"), !0)
}

TouchEmulator.multiTouchOffset = 75, supportTouch || new TouchEmulator;